/****************************************************
 * @class FurDetailsGridPanel
 * @extends Ext.Window
 ***************************************************/
	FurDetailsGridPanel = Ext.extend(Ext.grid.GridPanel,{
		condition: null,
		store: null,
		cm: null,
		constructor: function(config){
			Ext.apply(this,config);
			
			this.condition = {};
			this.condition.limit = 25;
			
			this.store = new Ext.data.Store({
			    baseParams: this.condition,   
				proxy: new Ext.data.HttpProxy({
					method: 'POST',
					url: '/pdm/report/getPmDelayDetail.htm'
				}),
				reader: new Ext.data.JsonReader({
					totalProperty: 'totalProperty',
					root: 'root',
					id: 'trackingNumber'
				},[
					{name: 'trackingNumber'},
					{name: 'category'},
					{name: 'organigerName'},
					{name: 'organigerDepartmentName'},
					{name: 'projectName'},
					{name: 'phaseName'},
					{name: 'task'},
					{name: 'dateOfExpect'},
					{name: 'dateOfPromise'},
					{name: 'dueDay'},
					{name: 'subTypeName'},
					{name: 'subject'},
					{name: 'status'}
				])
			});
			
			this.cm = new Ext.grid.ColumnModel([
		        {
		           header: "任务编号",
		           dataIndex: 'trackingNumber',
		           sortable: true,
		           width: 70
		        },{
		           header: "种类",
		           dataIndex: 'category',
		           width: 50
		        },{
		           header: "表单状态",
		           dataIndex: 'status',
		           width: 60
		        },{
		           header: "到期日",
		           dataIndex: 'dueDay',
		           width: 60,
		           renderer: renderDueDay
		        },{
		           header: "任务描述",
		           dataIndex: 'task',
		           width: 150
		        },{
		           header: "发起人",
		           dataIndex: 'organigerName',
		           width: 100
		        },{
		           header: "发起部门",
		           dataIndex: 'organigerDepartmentName',
		           width: 100
		        },{
		           header: "期望日期",
		           dataIndex: 'dateOfExpect',
		           width: 80
		        },{
		           header: "承诺日期",
		           dataIndex: 'dateOfPromise',
		           width: 80
		        }]);
		        	        
			FurDetailsGridPanel.superclass.constructor.call(this, {
				enableColumnMove: false,
				enableHdMenu: false,
			    loadMask: {msg:"信息载入中..."},
			    viewConfig: {forceFit: true},
				region: 'center',
				border: false,
				//autoHeight: true,
				layout: 'fit',
				split: true,
				stripeRows: true,
				ds: this.store,
				sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
				cm: this.cm,
				trackMouseOver: false,
				bbar: new Ext.PagingToolbar({
					pageSize: 25,
					store: this.store,
					displayInfo: true
				})
			});
		},
		load: function(c){
			this.condition.furNumber = c;
			this.store.load();
		}
	});
	
	function renderDueDay(v)
	{
		if(v*1<0)
		{
			v = "逾期" + Math.abs(v) + "天";
		}
		if(v*1 > 0)
		{
			v = v+"天";
		}
		return v;
	}

/****************************************************
 * @class FurDetailsWindow
 * @extends Ext.Window
 ***************************************************/
	FurDetailsWindow = Ext.extend(Ext.Window,{
		furDetailsGrid: null,
		constructor: function(config){
			Ext.apply(this,config);
			
			FurDetailsWindow.superclass.constructor.call(this, {
				layout: 'fit',
				width: 780,
				height: 360,
				modal: true,
				plain: true,
				resizable: false,
				closeAction: 'hide',
				buttonAlign: 'center',
				items: [this.furDetailsGrid]
			});
		},
		load: function(c)
		{
			this.furDetailsGrid.load(c);
		}
	});

	
/****************************************************
 * @class FurListWindow
 * @extends Ext.Window
 ***************************************************/
	FurListWindow = Ext.extend(Ext.Window,{
		furListGrid: null,
		keyName: null,
		constructor: function(config){
			Ext.apply(this,config);
			
			FurListWindow.superclass.constructor.call(this, {
				layout: 'fit',
				width: 420,
				height: 480,
				modal: true,
				plain: true,
				resizable: false,
				closeAction: 'hide',
				buttonAlign: 'center',
				items: this.furListGrid,
				buttons: [{
					text: "确定",
					scope: this,
					handler: function(){
						this.hide();
					}
				},{
					text: "关闭",
					scope: this,
					handler: function(){
						this.hide();
					}
				}]
			});
		},
		load: function(){
			this.furListGrid.store.load();
		}
	});
/****************************************************
 * @class FurListGridPanel
 * @extends Ext.grid.GridPanel
 ***************************************************/
	FurListGridPanel = Ext.extend(Ext.grid.GridPanel,{
		condition: null,
		store: null,
		cm: null,
		searchField: null,
		txtfld: null,
		constructor: function(config){
			Ext.apply(this,config);
			
			this.condition = {};
			this.condition.limit = 50;
			
			this.store = new Ext.data.Store({
			    baseParams: this.condition,   
				proxy: new Ext.data.HttpProxy({
					method: 'POST',
					url: '/pdm/pm/getFURList.htm'
				}),
				reader: new Ext.data.JsonReader({
					totalProperty: 'totalProperty',
					root: 'root',
					id: 'followUpRequisition_ID'
				},[
					{name: 'followUpRequisition_ID'},
					{name: 'trackingNumber'},
					{name: 'requisitioner'},
					{name: 'memo'}
				])
			});
			
			this.cm = new Ext.grid.ColumnModel([
		        {
		           header: "签核单号",
		           dataIndex: 'trackingNumber',
		           sortable: true,
		           width: 80
		        },{
		           header: "起草人",
		           dataIndex: 'requisitioner',
		           sortable: true,
		           width: 80
		        },{
		           header: "摘要",
		           dataIndex: 'memo',
		           sortable: true,
		           width: 100
		        }]);
	        
			FurListGridPanel.superclass.constructor.call(this, {
			    loadMask: {msg: "信息载入中..."},
			    viewConfig: {forceFit: true},
				region: 'center',
				border: false,
				height: 500,
				layout: 'fit',
				split: true,
				stripeRows: true,
				ds: this.store,
				sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
				cm: this.cm,
				trackMouseOver: false,
				tbar: ["查询："],
				bbar: new Ext.PagingToolbar({
					pageSize: 50,
					store: this.store,
					displayInfo: true
				})
			});
		}
	});